package com.ssh.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.ssh.entity.Commodity;
import com.ssh.service.CommodityService;

@Controller
@RequestMapping("/commodity")
public class CommodityController {
	
	@Autowired
	private CommodityService commodityService;
	
	@RequestMapping(value="/showCommdity.do")
	public String  showCommdity(String commodityName, HttpServletRequest req){
		Commodity  commodity = null;
		System.out.println("hello");
		commodity =  commodityService.showCommdityByName(commodityName);
		System.out.println(commodity.getName());
		req.setAttribute("commodity", commodity);
		return "productIntroduction";
		
	}
	
}
